
package com.jysz.webcore.ssh.web.interceptor;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.jysz.webcore.exceptions.WebSystemException;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;



/**
 * @author kacarich email:javaengine@outlook.com
 *
 */
public class ExceptionInterceptor extends AbstractInterceptor {

	private static final long serialVersionUID = 1L;
	private static final Logger LOG =  LoggerFactory.getLogger(ExceptionInterceptor.class);

	@Override
	public String intercept(ActionInvocation invocation) throws Exception {
		String result = ""; 
		try {
			result = invocation.invoke();
		} catch (Exception ex) {
			LOG.error("被捕获的系统异常", ex);
			throw new WebSystemException(ex, "程序内部错误，操作失败，");
		}
		return result;
	}

}
